@mixin response-to($type) {
  // 媒体查询尺寸类型
  $typeList: (
    mobile: (
      320px,
      480px
    ),
    pad: (
      481px,
      768px
    ),
    pc: 769px
  );

  @if not map-has-key($typeList, $type) {
    @error "没有找到媒体查询尺寸类型: #{$type}";
  }

  // 获取当前 $type 的尺寸
  $currentType: map-get($typeList, $type);

  // 生成媒体查询代码
  @if $type != pc {
    @media only screen and (min-width: nth($currentType, 1)) and (max-width: nth($currentType, 2)) {
      @content;
    }
  } @else {
    @media only screen and (min-width: $currentType) {
      @content;
    }
  }
}
